﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.views.world.machines {
    import flash.events.*;
    import net.wooga.pets.events.*;
    import net.wooga.pets.interfaces.*;
    import net.wooga.pets.models.world.vos.actors.*;
    import net.wooga.pets.views.world.*;
    import net.wooga.pets.constants.*;

    public class AbstractMachineMediator extends AbstractActorMediator {

        override public function onRegister():void{
            super.onRegister();
            eventMap.mapListener(this.view, EventConstants.HANDLE_ACTION, this.onHandleAction);
            this.init();
        }
        override protected function updateRenderList(_arg1:Event=null):void{
            this.storeViewRectangle();
        }
        override protected function storeViewRectangle():void{
            AbstractActorVO(this.vo).viewRectangle = this.view.getRect(this.view.stage);
        }
        override protected function updateRenderListForDragging(_arg1:Event=null):void{
        }
        override protected function onClick(_arg1:MouseEvent):void{
            _arg1.stopPropagation();
            dispatch(new InfoEvent(EventConstants.HANDLE_ACTION, id));
        }
        private function get vo():IMachine{
            return ((_vo as IMachine));
        }
        private function get view():AbstractMachineView{
            return ((viewComponent as AbstractMachineView));
        }
        protected function onHandleAction(_arg1:InfoEvent):void{
            dispatch(new InfoEvent(_arg1.type, _arg1.id, _arg1.info));
        }
        private function init():void{
            this.view.setState(this.vo.state);
        }

    }
}//package net.wooga.pets.views.world.machines 
